#include "processes/ChatClient.h"
#include "processes/ChatServer.h"
#include <errno.h>
#include <iostream>
#include <getopt.h>
#include <stdio.h>

int main(int argc, char **argv) {
	struct option long_options[] = {
			{ "server", no_argument, 0, 'S' },
			{ "cliente",no_argument, 0, 'C' },
			{ 0, 0,0, 0 }
	};
	int option_index = 0;
	int c = -1;

	while ((c = getopt_long(argc, argv, "SC", long_options,&option_index)) != -1) {
		switch (c) {
		case 'S':{
			ChatServer server;
			server.runProcess(argc,argv);

		}break;
		case 'C':{
			ChatClient cliente;
			if (argc < 2){
				std::cout<< "Required argument" << std::endl;
			}
			cliente.runProcess(argc,argv);

		}break;
		default:
			exit(1);
			break;
		}
	}
}


